﻿<!--#include file="mymin.asp"-->
<%

dim rs,sql,p
p=request.Querystring("p")
if p="" then p=1


if p=1 then
set rs=server.CreateObject("adodb.recordset")
sql="select linkindex,linkactive,iif(linknum>4,4,linknum) as linknum,links,Active,num from 74hu_ad where id=1"
rs.open sql,myconn,1,1%>
<title>友链设置</title></head><body><div class='main400'>
<form method="post" action="mymin_config.asp?sid=<%=sid%>&amp;p=2">
友链首页排版:<br/> 
<select name="linktop">
<option value="0">横排经典</option>
<option value="1" <% if rs("linkindex")=1 then w "selected"%>>简单分类</option>
</select><br/>
审核设置:<br/> 
<select name="Active">
<option value="1">必须审核</option>
<option value="0" <% if rs("Active")=0 then w "selected"%>>不用审核</option>
</select><br/>
跳转方式:<br/> 
<select name="links">
<option value="0">二次跳转</option>
<option value="1" <% if rs("links")=1 then w "selected"%>>直接跳转</option>
</select><br/>
友链简称字数:<br/>
<input name="linknum" type="text" value="<%=rs("linknum")%>" size="2"/><br/>
无链入自动隐藏天数:<br/>
<input name="linkact" type="text" value="<%=rs("linkactive")%>" size="2"/><br/>
无链入自动删除天数:<br/>
<input name="num" type="text" value="<%=rs("num")%>" size="2"/><br/>
<input type="submit" value="保存修改"/>
</form>
<a href='mymin_index.asp?sid=<%=sid%>'>[友链后台]</a>
<%elseif p=2 then%>
<title>友链设置结果</title></head><body><div class='main400'>
<%
	linktop=Request.Form("linktop")
	linkact=Request.Form("linkact")
	Active=Request.Form("Active")
	links=Request.Form("links")
	linknum=Request.Form("linknum")
	num=Request.Form("num")
	if linkact="" or IsNumeric(linkact) = False then
		Call Error("隐藏天数错误！")
	end if

	if num="" or IsNumeric(num) = False then
		Call Error("删除天数错误！")
	end if
	
	if linknum="" or IsNumeric(linknum) = False then
		Call Error("友链简称字数错误！")
	end if
	if linknum>4 then
		Call Error("友链简称字数不能大于4！")
	end if


	set rs=server.CreateObject("adodb.recordset")
	sql="select * from 74hu_ad where id=1"
	rs.open sql,myconn,1,3
	if not (rs.bof and rs.eof) then
		rs("linkindex")=linktop
		rs("linkactive")=linkact
		rs("linknum")=linknum
		rs("links")=links
		rs("Active")=Active
		rs("num")=num
		rs.update()
		w "成功设置！<br/>"
	end if
%>
<a href='mymin_index.asp?sid=<%=sid%>'>[友链后台]</a>
<%END IF

rs.close
Set rs=Nothing

call Last2%>